package com.info3k.client.utils;

import java.util.ArrayList;
import java.util.List;

public class ToolsClient {
	public static <T> List<T> fromArrayToCollection(T[] a) {
		List<T> c = new ArrayList<T>();
		for (T o : a) {
	        c.add(o);
	    }
		return c;
	}
	
	public static <T> T[] fromCollectionToArray(List<T> c, T[] a) {
		int i = 0; 
		for (T o : c) {
	        a[i] = o;
	        i++;
	    }
		return a;
	}
	
	public static boolean isEmail(String address) {
	    int pos = address.lastIndexOf("@");
	    return pos > 0 && (address.lastIndexOf(".") > pos) && (address.length() - pos > 4);
	}

}
